Fantom (programming Language)
   HOME

TheInfoList



OR:

Fantom is a general purpose
object-oriented programming language Object-oriented programming (OOP) is a programming paradigm based on the concept of "objects", which can contain data and code. The data is in the form of fields (often known as attributes or ''properties''), and the code is in the form of pro ...
created by Brian and Andy Frank that runs on the
Java Runtime Environment Java is a set of computer software and specifications developed by James Gosling at Sun Microsystems, which was later acquired by the Oracle Corporation, that provides a system for developing application software and deploying it in a cros ...
(JRE),
JavaScript JavaScript (), often abbreviated as JS, is a programming language that is one of the core technologies of the World Wide Web, alongside HTML and CSS. As of 2022, 98% of Website, websites use JavaScript on the Client (computing), client side ...
, and the .NET
Common Language Runtime The Common Language Runtime (CLR), the virtual machine component of Microsoft .NET Framework, manages the execution of .NET programs. Just-in-time compilation converts the managed code (compiled intermediate language code) into machine instructio ...
(CLR) (.NET support is considered "prototype" status). Its primary design goal is to provide a standard library
API An application programming interface (API) is a way for two or more computer programs to communicate with each other. It is a type of software Interface (computing), interface, offering a service to other pieces of software. A document or standa ...
that abstracts away the question of whether the code will ultimately run on the JRE or CLR. Like C# and
Java Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's List ...
, Fantom uses a curly brace syntax. The language supports
functional programming In computer science, functional programming is a programming paradigm where programs are constructed by Function application, applying and Function composition (computer science), composing Function (computer science), functions. It is a declar ...
through closures and concurrency through the
Actor model The actor model in computer science is a mathematical model of concurrent computation that treats ''actor'' as the universal primitive of concurrent computation. In response to a message it receives, an actor can: make local decisions, create more ...
. Fantom takes a "middle of the road" approach to its type system, blending together aspects of both
static Static may refer to: Places *Static Nunatak, a nunatak in Antarctica United States * Static, Kentucky and Tennessee *Static Peak, a mountain in Wyoming **Static Peak Divide, a mountain pass near the peak Science and technology Physics *Static el ...
and
dynamic typing In computer programming, a type system is a logical system comprising a set of rules that assigns a property called a type to every "term" (a word, phrase, or other set of symbols). Usually the terms are various constructs of a computer progra ...
.


Typing

Fantom's type system is simple by design. All variables are statically typed, as they are in C# and
Java Java (; id, Jawa, ; jv, ꦗꦮ; su, ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north. With a population of 151.6 million people, Java is the world's List ...
. Fantom rejects generic types due to their complexity, but it does have a set of built-in generic types: List, Map, and Func. Fantom can also take on the feel of a dynamically typed language through dynamic calls and automatic
downcasting In class-based programming, downcasting or type refinement is the act of casting a reference of a base class to one of its derived classes. In many programming languages, it is possible to check through type introspection to determine whether the ...
. Fantom has an easy to use
reflection Reflection or reflexion may refer to: Science and technology * Reflection (physics), a common wave phenomenon ** Specular reflection, reflection from a smooth surface *** Mirror image, a reflection in a mirror or in water ** Signal reflection, in s ...
API and
metaprogramming Metaprogramming is a programming technique in which computer programs have the ability to treat other programs as their data. It means that a program can be designed to read, generate, analyze or transform other programs, and even modify itself ...
capabilities. Fantom is open source under the
Academic Free License The Academic Free License (AFL) is a permissive free software license written in 2002 by Lawrence E. Rosen, a former general counsel of the Open Source Initiative (OSI). The license grants similar rights to the BSD, MIT, UoI/NCSA and Apache l ...
3.0 and is available for Windows and Unix-like platforms (including Mac OS X).


IDE and Tools

F4 is the main publicly available IDE for the Fantom language, officially supported by one of the main open source contributors to the language
Steve Eynon
The F4 IDE is available on GitHub https://github.com/xored/f4 More free tools and information are also available on https://fantom-lang.org/


Pods

In Fantom, the unit of deployment is called a ''pod''. Pods take on the role of
namespace In computing, a namespace is a set of signs (''names'') that are used to identify and refer to objects of various kinds. A namespace ensures that all of a given set of objects have unique names so that they can be easily identified. Namespaces ...
s,
packages Package may refer to: Containers or Enclosures * Packaging and labeling, enclosing or protecting products * Mail, items larger than a letter * Chip package or chip carrier * Electronic packaging, in electrical engineering * Automotive package, in ...
, and
modules Broadly speaking, modularity is the degree to which a system's components may be separated and recombined, often with the benefit of flexibility and variety in use. The concept of modularity is used primarily to reduce complexity by breaking a sy ...
. They are stored as .pod files, which are
zip Zip, Zips or ZIP may refer to: Common uses * ZIP Code, USPS postal code * Zipper or zip, clothing fastener Science and technology Computing * ZIP (file format), a compressed archive file format ** zip, a command-line program from Info-ZIP * Zi ...
files containing the FCode (the Fantom bytecode), the documentation, and resource files necessary to run the pod. A pod can define any number of types for use in other libraries and applications. A pod name fully qualifies a type name. For example, fwt::Widget is distinct from webapp::Widget. If a pod contains a type named Main, then it can be executed on the command line with: fan <podName> The Fantom build system can package a set of Pods into a JAR archive through build::JarDist.


Fantom Widget Toolkit

Fantom ships with a standard
windowing toolkit A widget toolkit, widget library, GUI toolkit, or UX library is a library or a collection of libraries containing a set of graphical control elements (called ''widgets'') used to construct the graphical user interface (GUI) of programs. Most widge ...
called the Fantom Widget Toolkit, or FWT for short. Like Fantom, FWT was designed to be portable across several platforms. It is currently implemented on the JVM using the
Standard Widget Toolkit The Standard Widget Toolkit (SWT) is a graphical widget toolkit for use with the Java platform. It was originally developed by Stephen Northover at IBM and is now maintained by the Eclipse Foundation in tandem with the Eclipse IDE. It is an alter ...
as a backend. The JavaScript implementation is backed by the
canvas element The canvas element is part of HTML5 and allows for dynamic, scriptable rendering of 2D shapes and bitmap images. It is a low level, procedural model that updates a bitmap. HTML5 Canvas also helps in making 2D games. While the HTML5 canvas off ...
and
JavaFX JavaFX is a software platform for creating and delivering desktop applications, as well as rich web applications that can run across a wide variety of devices. JavaFX has support for desktop computers and web browsers on Microsoft Windows, Linu ...
, allowing FWT applications to be run in a web browser. There are plans for a CLR implementation using
Windows Forms Windows Forms (WinForms) is a free and open-source graphical (GUI) class library included as a part of Microsoft .NET, .NET Framework or Mono Framework, providing a platform to write client applications for desktop, laptop, and tablet PCs. While ...
.


"Hello World" example

Here is the classic
Hello world program ''Hello'' is a salutation or greeting in the English language. It is first attested in writing from 1826. Early uses ''Hello'', with that spelling, was used in publications in the U.S. as early as the 18 October 1826 edition of the ''Norwich C ...
written in Fantom: // Hello from Fantom! class HelloWorld Notice that "Void" is capitalized. This is because Void is a class, not a primitive type in Fantom.


Name change

The original name of the Fantom programming language was Fan, named after the
neighborhood A neighbourhood (British English, Irish English, Australian English and Canadian English) or neighborhood (American English; see spelling differences) is a geographically localised community within a larger city, town, suburb or rural area, ...
where the creators live in
Richmond, Virginia (Thus do we reach the stars) , image_map = , mapsize = 250 px , map_caption = Location within Virginia , pushpin_map = Virginia#USA , pushpin_label = Richmond , pushpin_m ...
. After the language gained some popularity, members of the community raised concerns about the searchability of the name. In November 2009, the name of the project was officially changed from Fan to Fantom.Fan is officially now Fantom
/ref>


Other features

Fantom has other useful features: * Fantom supports imports of Java Classes and modules with some limitations. * Integer is 64-bit. Unlike Java and C#, Fantom does not have Long or Short integer types. * Serialization and deserialization of classes to/from strings. * Fantom does ''not'' support
tuple In mathematics, a tuple is a finite ordered list (sequence) of elements. An -tuple is a sequence (or ordered list) of elements, where is a non-negative integer. There is only one 0-tuple, referred to as ''the empty tuple''. An -tuple is defi ...
s (that is, types which are the
Cartesian product In mathematics, specifically set theory, the Cartesian product of two sets ''A'' and ''B'', denoted ''A''×''B'', is the set of all ordered pairs where ''a'' is in ''A'' and ''b'' is in ''B''. In terms of set-builder notation, that is : A\ti ...
of other types)Tuples question at Fantom official page
/ref>


A game - in Fantom?

'
Escape the Mainframe
'' is a browser game (just like the Google t-rex dinosaur) completely written in Fantom b
Steve Eynon
http://escape.fantomfactory.org/


See also

* Boo *
Ceylon Sri Lanka (, ; si, ශ්‍රී ලංකා, Śrī Laṅkā, translit-std=ISO (); ta, இலங்கை, Ilaṅkai, translit-std=ISO ()), formerly known as Ceylon and officially the Democratic Socialist Republic of Sri Lanka, is an ...
*
Gosu Gosu (고수) is a Korean term used to refer to a highly skilled person. In computer gaming the term is usually used to refer to a person who dominated games like ''StarCraft'', ''Counter-Strike'', Tekken, ''Warcraft III'', ''Diablo II ''D ...
*
Apache Groovy Apache Groovy is a Java-syntax-compatible object-oriented programming language for the Java platform. It is both a static and dynamic language with features similar to those of Python, Ruby, and Smalltalk. It can be used as both a programming lang ...
* Kotlin *
Ruby A ruby is a pinkish red to blood-red colored gemstone, a variety of the mineral corundum ( aluminium oxide). Ruby is one of the most popular traditional jewelry gems and is very durable. Other varieties of gem-quality corundum are called sa ...


References


Further reading

* *


External links

*
Open source website: https://fantom-lang.org/download
* Open source repository for Fantom libraries https://eggbox.fantomfactory.org/ * Fantom portfolio https://fantom-lang.org/portfolio
Not a Fan of Scala? An Evolutionary Approach , Ajaxonomy
- blog post discussing ''Fan''
Fan of a New Language , SD Times

Re: Fan Programming Language (jvm-languages@googlegroups.com mailing list)
a forum post by one of Fantom's authors.

a conversation with Stephen Colebourne by Bill Venners.
Language reference page at LangRef.org
{{DEFAULTSORT:Fantom (Programming Language) Object-oriented programming languages Statically typed programming languages JVM programming languages .NET programming languages Programming languages created in 2005 Software using the Academic Free License